package com.chushouya.manager.dto.admin.im;

import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 极光推送
 */
@Getter
@NoArgsConstructor
public class PushBody {

    /**
     * 标题
     */
    private String title;

    /**
     * 消息内容
     */
    private String content;


    private Map<String, String> extraMap;

    private PushBody(final String content) {
        this.content = content;
        this.extraMap = new HashMap<>();
    }

    /**
     * 获取Body对象
     */
    public static PushBody builder(final String content) {
        return new PushBody(content);
    }

    /**
     * 获取Body对象
     */
    public static PushBody builder(final String title, final String content) {
        final PushBody pushBody = new PushBody(content);
        pushBody.setTitle(title);
        return pushBody;
    }

    /**
     * 添加参数
     */
    public PushBody addExtra(final String key, final String value) {
        this.extraMap.put(key, value);
        return this;
    }

    public PushBody setTitle(final String title) {
        this.title = title;
        return this;
    }

}
